Field of the Invention
The present invention relates to a three-dimensional measuring technique of measuring the surface shape of an object.
Description of the Related Art
There is known a pattern projecting method to measure the shape of an object based on deformation of a pattern projected onto the object, using the principle of triangulation, by projecting a plurality of kinds of light patterns onto the object and capturing the object upon projection of each light pattern. By using the Space Coding method as an example, a measuring method and the concept of reliability will be explained below.
The arrangement of a general apparatus for measuring a three-dimensional shape and the concept of three-dimensional measurement will be described with reference to FIG. 11. A three-dimensional measuring apparatus generally includes a projector 102 which projects a light pattern onto an object (an object to be measured) 110, and a camera 103 which captures a reflected pattern from the object 110. The projector 102 projects, onto the object 110, a striped light pattern in which a bright section and a dark section alternate with an arbitrary width. The striped light pattern includes a plurality of predetermined pattern shapes. Every time each of the pattern shapes is projected, the camera 103 captures the pattern shape to acquire image data. Let (X, Y, Z) be the boundary position between a bright section and a dark section of the object 110. (X1, Y1) represents the position of the intersection point of the display element surface of the projector 102 and a straight line which connects the boundary position (X, Y, Z) with the principal point of the projector 102. Similarly, (X2, Y2) represents the position of the intersection point of the sensor surface of the camera 103 and a straight line which connects the boundary position (X, Y, Z) with the principal point of the camera 103. Note that the position (X2, Y2) of the intersection of the sensor surface of the camera 103 is obtained by the horizontal coordinate of the image sensor (CCD, CMOS, or the like) of the camera 103. The horizontal coordinate is determined by the horizontal and vertical widths of the image sensor. For a 640×480 image sensor, the x-coordinate in the horizontal direction ranges from 0 to 640 and the y-coordinate in the vertical direction ranges from 0 to 480. Similarly, the position (X1, Y1) of the intersection point of the display element surface of the projector 102 is obtained by the horizontal coordinate of a projection sensor. A distance L between the projector 102 and the camera 103 is the base line length and is determined based on the arrangement condition of the apparatus. It is possible to obtain the boundary position (X, Y, Z) of the object 110 using those parameters according to the principle of triangulation. It is thus possible to measure the three-dimensional shape of the object 110 by obtaining the boundary position (X, Y, Z) for the entire surface of the object 110.
The shape of the striped light pattern will be explained. A striped light pattern of a binary code called a gray code having a coding error resilience will be described below with reference to FIGS. 12A to 12C. A section which is observed as black on a captured reflected pattern corresponds to “0”, and that which is observed as white corresponds to “1”. Referring to FIG. 12A, the entire pattern is divided into two regions, which are encoded as “1” and “0”. Referring to FIG. 12B, four regions of bright and dark sections are encoded as “1”, “0”, “0”, and “1”, and irradiated with a corresponding striped light pattern to be captured. Furthermore, referring to FIG. 12C, eight regions are encoded as “1”, “0”, “0”, “1”, “1”, “0”, “0”, and “1”, and irradiated with a corresponding striped light pattern to be captured. When the regions are sequentially irradiated with these three kinds of striped patterns, each region can be represented by three bits. That is, the respective regions can be described by (1, 1, 1), (1, 1, 0), (1, 0, 0), (1, 0, 1), (0, 0, 1), (0, 0, 0), (0, 1, 0), and (0, 1, 1). Since a space can be divided into eight regions using the three striped light patterns in this manner, the Space Coding will be referred to as 3-bit Space Coding hereinafter. Then, the respective striped light patterns shown in FIGS. 12A to 12C will be respectively referred to as 1-bit striped light pattern, 2-bit striped light pattern, and 3-bit striped light pattern hereinafter.
To perform three-dimensional measurement in more detail, regions of bright and dark sections are irradiated with n striped light patterns while sequentially reducing the regions in size. Then, by assigning region numbers obtained by dividing an irradiation region of the projector into 2n regions, the respective regions can be determined. In three-dimensional measurement in which a region is divided into 1024 regions, 10-bit Space Coding is performed.
The merit of the gray code lies in that even when a coding error occurs at a region boundary due to a shift or blur of a striped light pattern, such error is merely determined to be a neighboring region, and does not cause any coding error as a largely shifted region. For this reason, the Space Coding method using the gray code is generally used.
To improve the precision in three-dimensional measurement by the Space Coding method, a horizontal coordinate position x (to be referred to as “boundary position” hereinafter) of the boundary between bright and dark sections has to be decided from captured image data. The boundary position between bright and dark sections will be described with reference to FIGS. 13A and 13B. FIG. 13A is a graph when the ordinate plots the luminance values of image data obtained by capturing a 2-bit striped light pattern, and the abscissa plots the horizontal coordinates x. Ideal boundary positions are shown in the lower portion of FIG. 13A. In FIG. 13A, since the bright and dark sections have different luminance values “1” and “0” at the boundaries, the boundary positions between the bright and dark sections are uniquely decided. That is, positions a and b can be decided as boundary positions. However, in actual measurement, a moderate change is observed in the vicinity of each boundary in an image actually captured by the camera 103 due to the influences of, for example, a blur of a striped light pattern, the reflectance of an object, and ambient light, as shown in FIG. 13B, and boundary positions cannot be uniquely decided, thus causing measurement errors.
To avoid such program, a method which assigns reliability indicating measurement precision to each measuring point, and does not use measuring coordinates if the reliability of the coordinates is equal to or lower than a threshold is disclosed (for example, see Japanese Patent No. 3996560 which is to be referred to as reference 1 hereinafter).
In reference 1, an object is irradiated with full-illumination light corresponding to a bright section on the entire pattern and full-extinction light corresponding to a dark section on the entire pattern in addition to a striped light pattern. The upper limit luminance value obtained by the full-illumination light and the lower limit luminance value obtained by the full-extinction light are obtained and used to calculate contrast, thereby setting it as reliability.
In the technique disclosed in reference 1, the contrast of a striped light pattern is set as reliability. In this case, the influence of a luminance exerted by noise in three-dimensional measurement is not considered. Three-dimensional measurement actually includes uncertain noise (to be referred to as noise information in the three-dimensional measurement hereinafter) due to the camera, object, projector, ambient light, and the like. Consequently, the reliability based on the contrast obtained in reference 1 does not include noise information in three-dimensional measurement, and thus has an incorrect value.